package com.douguo.recipe;

import android.app.Application;
import android.util.Log;

import com.douguo.recipe.manager.AppRuntime;
import com.douguo.recipe.manager.Registry;
import com.douguo.recipe.manager.SharedPreferencesManager;
import com.douguo.recipe.network.Constant;

public class DouguoApplication extends Application {
	
	private static final String TAG = "DouguoApplication";
	
	private Registry mRegistry;
	private AppRuntime mAppRuntime;
	
	private boolean youMengAppExchangePrapare;
	
	public void onCreate() {
		super.onCreate();
		mAppRuntime = AppRuntime.getInstance();
		initRegistry();
		Log.d(TAG, "onCreate");
    }

	private void initRegistry() {
		mRegistry = Registry.getInstance();
		SharedPreferencesManager preferencesManager = new SharedPreferencesManager();
		preferencesManager.init(getApplicationContext());
		mRegistry.put(Constant.PREFERENES_MANAGER, preferencesManager);
	}
	
	public Registry getRegistry() {
		return mRegistry;
	}
	
	public AppRuntime getAppRuntime() {
		return mAppRuntime;
	}

	public void setYouMengExchange(boolean b){
		youMengAppExchangePrapare = b;
	}
	
	public boolean getYouMengExchange(){
		return youMengAppExchangePrapare;
	}
}
